Fix handling of duplicate (evil) bindings in show keymap
authorJustin Burkett <justin@burkett.cc>
Fri, 8 Jun 2018 12:51:48 +0000 (08:51 -0400)
committerJustin Burkett <justin@burkett.cc>
Fri, 8 Jun 2018 12:51:48 +0000 (08:51 -0400)
which-key.el

index e4c372d4f3a4c3e5c9c740c96f1cd82ffc6370e2..29b38f0d4de28aea8d33b986e3d2db391c3b4eeb 100644 (file)
@@ -1707,8 +1707,12 @@ ones. PREFIX is for internal use and should not be used."
                      (bound-and-true-p evil-local-mode)
                      (string-match-p (format "<%s-state>$" evil-state) key-desc))
                 (setq bindings
-                      (append bindings
-                              (which-key--get-keymap-bindings def all prefix))))
+                      ;; this function keeps the latter of the two duplicates
+                      ;; which will be the evil binding
+                      (cl-remove-duplicates
+                       (append bindings
+                               (which-key--get-keymap-bindings def all prefix))
+                       :test (lambda (a b) (string= (car a) (car b))))))
                ((and (keymapp def)
                      (string-match-p which-key--evil-keys-regexp key-desc)))
                ((and (keymapp def)